﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for Game
/// </summary>
public class Game
{
    private List<Player> _players;
    private Deck _deck;
    private Dictionary<CardRank, Player> _books;

    public Game(string playerName, IEnumerable<string> opponentNames)
	{
        _players = new List<Player>();
        _players.Add(new Player(playerName));
        foreach (string player in opponentNames)
            _players.Add(new Player(player));
        _books = new Dictionary<CardRank, Player>();
        _deck = new Deck();
        Deal();
	}

    private void Deal()
    {
        _deck.Shuffle();
        for (int i = 0; i < 5; i++)
            foreach (Player player in _players)
                player.addCardToHand(_deck.Deal());
        //foreach (Player player in _players)
        //    PullOutBooks(player);
    }

    public List<Card> GetPlayerCardNames()
    {
        return _players[0].GetCardNames();
    }

    //public bool PullOutBooks(Player player)
    //{
    //    //IEnumerable<CardRank> booksPulled = player.PullOutBooks();
    //    //foreach (CardRank rank in booksPulled)
    //    //    _books.Add(rank, player);
    //    //if (player.CardCount == 0)
    //    //    return true;
    //    //return false;
    //}

}